Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Breakpoint state can survive crash or cancellation recovery, and the hidden cache-sync mapping conflicts with the public mapping contract.
4 open findings
What changed in this PR
Adds Windows ARM64 WHP guest debugging and generalizes the GDB implementation across architectures.
Changes:
- Adds ARM64 registers, software breakpoints, stepping, and cache synchronization.
- Extracts shared debugger logic from x86_64 code.
- Updates tests, documentation, and platform configuration.
| File | Description |
|---|---|
CHANGELOG.md |
Records ARM64 GDB support. |
docs/how-to-debug-a-hyperlight-guest.md |
Documents architecture-specific capabilities. |
src/hyperlight_host/build.rs |
Enables GDB on Windows ARM64. |
src/hyperlight_host/examples/guest-debugging/main.rs |
Adds ARM64 debugging tests. |
src/hyperlight_host/src/hypervisor/gdb/arch.rs |
Dispatches architecture-specific logic. |
src/hyperlight_host/src/hypervisor/gdb/arch/aarch64.rs |
Implements ARM64 breakpoint and step decoding. |
src/hyperlight_host/src/hypervisor/gdb/arch/x86_64.rs |
Houses extracted x86_64 logic. |
src/hyperlight_host/src/hypervisor/gdb/event_loop.rs |
Maps ARM64 stop reasons. |
src/hyperlight_host/src/hypervisor/gdb/mod.rs |
Extends shared debugging interfaces. |
src/hyperlight_host/src/hypervisor/gdb/target.rs |
Adds architecture-specific GDB registers. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs |
Connects GDB to ARM64 VMs. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/debug.rs |
Centralizes breakpoint and stepping state. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/mod.rs |
Handles ARM64 debug exits. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs |
Removes extracted debugger logic. |
src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs |
Extends VM exits and errors. |
src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs |
Implements WHP debugging and cache synchronization. |
src/hyperlight_host/src/sandbox/initialized.rs |
Guards snapshots with active breakpoints. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| DebugMsg::DisableDebug => { | ||
| detach = true; | ||
| DebugResponse::DisableDebug | ||
| } |
| #[cfg(target_arch = "aarch64")] | ||
| if let Err(e) = self.cancel_pending_software_step(mem_mgr) { | ||
| break Err(HandleDebugError::from(e).into()); |
| .copy_from_slice(&DEBUG_CACHE_SYNC_CODE, 0) | ||
| .map_err(|e| CreateVmError::InitializeDebug(e.to_string()))?; | ||
| let (host_memory, guest_memory) = memory.build(); | ||
| let region = guest_memory.mapping_at(DEBUG_CACHE_SYNC_GPA, MemoryRegionType::Scratch); |
| // aligned. However, the ABI requirement is that the stack | ||
| // be aligned _before a call instruction_, which means | ||
| // that the stack needs to actually be ≡ 8 mod 16 at the | ||
| // that the stack needs to actually be ≡ 8 mod 16 at the |
## Summary Adds GDB stub support for guests running on the ARM64 WHP backend. ## Changes ### Debug core * Split the x86_64 debug code out of `hyperlight_vm/x86_64.rs` into a shared `hyperlight_vm/debug.rs`. * Rename `gdb/x86_64_target.rs` to `gdb/target.rs` and add per-architecture register handling in `gdb/arch/`. * Give `DebuggableVm` default methods so backends without hardware breakpoints or single step report `Unsupported`. ### ARM64 WHP * Implement `DebuggableVm` for the aarch64 WHP VM, using the batched register helpers. * Flush the host instruction cache after guest memory writes so software breakpoints take effect. ### Docs * Document ARM64 debugging in `docs/how-to-debug-a-hyperlight-guest.md` and `CHANGELOG.md`. ## Verification On Windows ARM64 (WHP): * `just build`, `just clippy`, `just guests`, `just test` and `just fmt-check` pass. --------- Signed-off-by: cshung <3410332+cshung@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Changes * Run the full disable path when the debugger detaches after a crash, so software breakpoints and pending steps are cleaned up. * Cancel pending software steps for any cancellation source, not only debugger interrupts. * Reject `map_region` requests that overlap the hidden cache sync page at GPA 0x1000, and add a test. * Restore the `≡` and `×` characters in `hyperlight_vm/x86_64.rs` comments. ## Verification On Windows ARM64 (WHP): * `just clippy`, `just fmt-check` and the `hypervisor::` and `map_region` lib tests with the `gdb` feature pass. --------- Signed-off-by: cshung <3410332+cshung@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8c0c245 to
39ea4cb
Compare
Benchmark ResultsMeasured commit: kvm / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |



Summary
Adds GDB stub support for guests running on the ARM64 WHP backend.
Changes
Debug core
hyperlight_vm/x86_64.rsinto a sharedhyperlight_vm/debug.rs.gdb/x86_64_target.rstogdb/target.rsand add per-architecture register handling ingdb/arch/.DebuggableVmdefault methods so backends without hardware breakpoints or single step reportUnsupported.ARM64 WHP
DebuggableVmfor the aarch64 WHP VM, using the batched register helpers.Docs
docs/how-to-debug-a-hyperlight-guest.mdandCHANGELOG.md.Verification
On Windows ARM64 (WHP):
just build,just clippy,just guests,just testandjust fmt-checkpass.